package com.lijy.collection;


import com.szkingdom.kfit.bank.common.util.XMLUtil;
import jxl.demo.XML;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;

import java.util.List;

/**
 * @author Lijingyu on 2017/10/12.
 */
public class TestList {

    public static void main(String[] args) {

        List mylist = getXmlList();
        System.out.println(mylist);
        System.out.println(mylist.size());
    }

    public static List getXmlList() {
        Document document = null;
        try {
            document = XMLUtil.read("/com/lijy/collection/chinalife.xml");
        }
        catch (DocumentException e) {
            e.printStackTrace();
        }

        List<Element> xmlList = document.selectNodes("//config/xmlFields/item");

        for (Element element : xmlList) {
            System.out.println(element.element("name").getTextTrim());
            System.out.println(XMLUtil.getSubElementText(element, "name"));
        }

        return xmlList;
    }
}
